package com.zjkj.mp.service.channel.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import com.zjkj.mp.dao.channel.ChannelDao;
import com.zjkj.mp.service.channel.ChannelService;
import com.zjkj.mp.utils.PaginatedResult;
import com.zjkj.mp.vo.channel.MpChannel;

@Service
@Transactional(rollbackFor=Exception.class)
public class ChannelServiceImpl implements ChannelService {

	@Resource(name="channelDaoImpl")
	ChannelDao channelDao;

	public List<MpChannel> getMpChannelList(String tdId) {
		List<MpChannel> list = null;
		if(tdId==null||"".equals(tdId)){
			list = channelDao.getMpChannelList();
		} else {
			list = channelDao.getMpChannelList(Integer.parseInt(tdId));
		}
		return list;
	}

	public int insertMpChannel(MpChannel channel) {
		return channelDao.insertMpChannel(channel);
	}

	public int delMpChannel(int tdId) {
		return channelDao.delMpChannel(tdId);
	}

	public int updMpChannel(MpChannel channel) {
		return channelDao.updMpChannel(channel);
	}

	public int flagChannel(int tdId, int tdzt) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("tdId", tdId);
		map.put("tdzt", tdzt);
		return channelDao.flagChannel(map);
	}

	public PaginatedResult getMpChannelPageList(int nowPage, int maxRow,
			Map<String, Object> map) {
		return channelDao.getMpChannelPageList(nowPage, maxRow, map);
	}

	@Override
	public List<MpChannel> getMpChannelListStart(int tdzt) {
		return channelDao.getMpChannelListStart(tdzt);
	}

}
